<?php defined('BASEPATH') OR exit('No direct script access allowed');


class Dict_model extends Base_model
{
	protected $_table_name = 'dict';
    protected $_key_name = 'id';
	
	public function __construct()
    {
        parent::__construct();
		
    }

    public function lists($limit = NULL,$map_arr = NULL)
    {
        $this->select("id,label,value,type,sort, description, remarks");
        //print_r($map_arr);
        if($map_arr["label"])
        {
            $this->where("label",$map_arr["label"]);
        }
    	$this->where('dtime',0);
    	if($this->set_limit($limit))
    	{
    		return $this->result_rows();
    	}
    	else
    	{
    		return $this->result();
    	}
    	
    }

    public function saves($data_arr = NULL)
    {
        if($data_arr == NULL) return false;

        $data_arr["ctime"] = time();
        return $this->replace($data_arr);
    }

    public function dels($ids_arr = NULL)
    {
        if($ids_arr == NULL) return false;
        $this->where_in($this->_key_name,$ids_arr);
        $data_arr['dtime'] = time();
        return $this->update($data_arr);
    }
	
}
/* End of file base_model.php */
/* Location: ./system/application/models/base_model.php */
